package cn.nbt.busManage.model.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.NamedQueries;
import org.hibernate.annotations.NamedQuery;

import java.sql.Date;
import java.time.LocalDateTime;

@Entity
@Data
@EqualsAndHashCode(callSuper = true)
@Table(name = "news")
@NamedQueries({
        @NamedQuery(name = "News.findbyName",
                query = "SELECT a FROM News a WHERE a.author = :query")
})
public class News extends BaseEntity{
    @Column(name = "title")
    private String title;
    @Column(name="author")
    private String author;
    @Column(name="content",length = 8000)
    private String content;
    @Column(name = "create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(name="update_time")
    private LocalDateTime updateTime;
}
